from can import BLFReader, ASCWriter
from asammdf import MDF

# 输入和输出文件路径
blf_file = "TSMaste2025_04_21_16_00_57.blf"
asc_file = "续航里程.asc"

# # 加载BLF文件
# mdf = MDF(blf_file)
# # 导出为ASC
# mdf.save(asc_file, format="ASC")


# 读取 BLF 文件并写入 ASC 文件
with BLFReader(blf_file) as blf:
    with ASCWriter(asc_file) as asc:
        for msg in blf:
            asc.on_message_received(msg)

